/*
 * @Author: ૮₍ ˙О˙₎ა
 * @Date: 2023-07-21 18:19:59
 */
import type { ISkuDetailPublic, ISkuList } from '@/types/sku'
import { http } from '@/utils/request'

/**
 * @description sku 列表
 * @returns
 */
export const reqSkuList = (page: number, limit: number) => {
  return http<ISkuList>(`/admin/product/list/${page}/${limit}`, 'GET')
}

/**
 * @description sku 详情
 * @returns
 */
export const reqSkuDetail = (id: number) => {
  return http<ISkuDetailPublic>(`/admin/product/getSkuById/${id}`, 'GET')
}

/**
 * @description sku 新增
 * @returns
 */
export const reqSaveSku = (data: ISkuDetailPublic) => {
  return http(`/admin/product/saveSkuInfo`, 'POST', data)
}

/**
 * @description sku 上架
 * @returns
 */
export const reqCancelSale = (id: number) => {
  return http(`/admin/product/cancelSale/${id}`, 'GET')
}

/**
 * @description sku 下架
 * @returns
 */
export const reqOnSale = (id: number) => {
  return http(`/admin/product/onSale/${id}`, 'GET')
}

/**
 * @description sku 删除
 * @returns
 */
export const reqDeleteSku = (id: number) => {
  return http(`/admin/product/deleteSku/${id}`, 'DELETE')
}
